package com.hicoffee.bm.service.impl;

import com.hicoffee.bm.model.CustomerTerminal;
import com.hicoffee.bm.service.CustomerTerminalService;
import com.hicoffee.bm.mapper.CustomerTerminalMapper;
import com.hicoffee.bm.utils.ResponseUtil;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.radarwin.framework.util.StringUtil;
import com.radarwin.framework.web.response.ResponseWrapper;
import java.util.HashMap;
import java.util.Map;
import com.radarwin.framework.util.JsonUtil;
/**
 *  auto generated by generation tools v1.0.0
 */
@Service
public class CustomerTerminalServiceImpl extends BaseService<CustomerTerminal> implements CustomerTerminalService {

    @Autowired
    private CustomerTerminalMapper customerTerminalMapper;



    @Override
    public ResponseWrapper getCustomerTerminalPageList (Map<String,Object> params){
        // 设置分页参数
         String pageNum = StringUtil.getString(params.get("page"));
         String pageSize = StringUtil.getString(params.get("rows"));
         String queryAsJson = StringUtil.getString(params.get("queryParams"));
         if(StringUtil.isEmpty(pageNum)||StringUtil.isEmpty(pageSize)){
            return ResponseUtil.errorResponse("必要分页参数不能为空");
         }
         Map<String,Object> queryParams = new HashMap<>();
         if(StringUtil.isNotEmpty(queryAsJson)){
            queryParams= JsonUtil.jsonToMap(queryAsJson);
         }
    	PageHelper.startPage(Integer.valueOf(pageNum), Integer.valueOf(pageSize));
    	return ResponseUtil.successResponse("page", new PageInfo<>(customerTerminalMapper.getCustomerTerminalPageList(queryParams)));
    }



}
